package com.yeswater.multithread.chapter7;

/**
 * author : yeswater
 * date : 2023/11/5
 *
 * NEW  RUNNABLE    TERMINATED
 */

public class Run_7_1_1 {
    public static void main(String[] args) throws InterruptedException {
        MyThread t1 = new MyThread();
        System.out.println("main 方法中的状态 1 : " + t1.getState());
        Thread.sleep(1000);
        t1.start();
        Thread.sleep(1000);
        System.out.println("main 方法中的状态 2 : " + t1.getState());
    }

    private static class MyThread extends Thread {
        public MyThread() {
            System.out.println("构造方法中的状态 Thread.currentThread().getState()=" + Thread.currentThread().getState());
            System.out.println("构造方法中的状态 this.getState()=" + this.getState());
        }

        @Override
        public void run() {
            System.out.println("run 方法中的状态 : " + Thread.currentThread().getState());
        }
    }
}
